﻿using System;
using System.Linq;
using System.Web.UI.WebControls;
using Models;
using System.Data;


public partial class czlist : System.Web.UI.Page
{

    private DataTable dc = new DataTable();
    public string AllCZ = "0", AllGoods = "0", AllTX = "0", AllLR = "0";
    protected void Page_Load(object sender, EventArgs e)
    {
        grdbind();
    }

    public void grdbind()
    {
        using (Entities bll = new Entities())
        {
            var  bb = bll.U_CZ.OrderByDescending(x => x.CZID);

            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = bb.ToList();  //这里好像一定要Tolist();不然会有点错误；
            pds.AllowPaging = true;
            AspNetPager1.RecordCount = bb.Count(); //记录总数；
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;

            this.rptList.DataSource = pds;
            this.rptList.DataBind();
        }
    }

    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {   //当页面页数改变时，执行这个方法；
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        grdbind();
    }
}

